package com.cl.security.core.controller;

import com.cl.security.base.controller.BaseController;
import com.cl.security.common.result.CommonResult;
import com.cl.security.core.entity.Product;
import com.cl.security.core.service.ProductService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("product")
public class ProductController extends BaseController<Product,ProductService> {
    private final ProductService productService;
    public ProductController(ProductService service, ProductService productService) {
        super(service, Product.class);
        this.productService = productService;
    }

    @GetMapping("generateSku")
    public CommonResult generateSku(Long productId) {
        return productService.generateSku(productId);
    }

    @PostMapping("uploadPropertyValueImage")
    public CommonResult uploadPropertyValueImage(@RequestParam("file")MultipartFile file,Long id) {
        return productService.uploadPropertyValueImage(file, id);
    }
}
